
% school path
%javarmpath 'H:\workspace (eclipse)\ImagingSci'

% my notebook path
javarmpath 'C:\Program Files\eclipse\workspace\ImagingSci'

javaclasspath

%javaaddpath 'H:\workspace (eclipse)\ImagingSci'
javaaddpath 'C:\Program Files\eclipse\workspace\ImagingSci'

javaclasspath

gui = javaObject('screen_calibration.Calibrate')

gui.setVisible(true)
%gui.pack();

% wait for the data will be ready...
while(gui.isDataReady() == false)
    pause(0.5)
end

% Gets the data from the java program
xyz = gui.getXYZValues();
rgb = gui.getRGBValues();
gamma = gui.getGamma();

% call function that calculates the Primaries
gamma_rgb = (((double(rgb))./255).^gamma).*255

% gammaRGB*MM=RGB
p_inv_rgb = pinv(gamma_rgb) % find the pseudoinverce matrix

M = double(xyz)*p_inv_rgb   % find the wanted matrix transform

% MM = 

% sets the Primaries result back to the java program
% gui.setPrimariesData(M);


% note need to add another main loop that will check 
% if the user wants to do another test 